<template>
  <view class="app-container">
    <div>
      <device-list type="invalid" :data="list"></device-list>
    </div>
  </view>
</template>

<script>
import { userExpirePhone } from '@/api/api.js'
import DeviceList from '@/components/DeviceList/DeviceList.vue'
export default {
  components: { DeviceList },
  data() {
    return {
      list:[]
    }
  },
  onNavigationBarButtonTap(btn) {
    switch (btn.index) {
      case 0:
        uni.switchTab({
          url: '/pages/team/team'
        })
        break
    }
  },
  onLoad(item) {
    this.init(item.id)
  },
  methods: {
    init(uid) {
      userExpirePhone({ uid }).then(res => {
        if (res.code === 10000) {
          this.list = res.data.map(e=>({
            ...e,
            effectiveTime:uni.$u.timeFormat(e.effectiveTime,'yyyy-mm-dd'),
            createdAt:uni.$u.timeFormat(e.createdAt,'yyyy-mm-dd'),
          }))
        }
      })
    }
  }
}
</script>

<style lang="scss"></style>
